Ext.onReady(function () {
            new Ext.Viewport({
                title: "Viewport",
                enableTabScroll: true,
                layout: "border",
                items: [north, west, center, east, south]
            });
            setusername();
            showNotLook();
            getWorkTheme();
        });

Ext.Ajax.on('requestcomplete',checkUserSessionStatus, this);   //所有的异步请求都会走的事件,拦截登录超时的请求
//主题列表
var themes = [['默认','ext-all.css'],['黑色','ext-all-access.css'],
              ['灰色','ext-all-gray.css'],['蓝色边框','ext-all-neptune.css'],
              ['蓝绿色','xtheme-olive.css'],['橘黄色','xtheme-orange.css'],
              ['红色','xtheme-red5.css']];
var themestore = new Ext.data.SimpleStore({
	fields:['theme','id'],
	data:themes
});
//主题更换
onMycomboboxChange11=function(field, newValue, oldValue, eOpts) {
   if(newValue!=oldValue){
       Ext.util.CSS.swapStyleSheet('theme','Ext/resources/css/'+newValue);
   }
};
function checkUserSessionStatus(conn,response,options){
	var str = response.responseText;
	if(str == '9999'){
		alert('连接已超时,请重新登录!');
		window.location.href = 'login.jsp';
	}
}

function showNotLook(){
	Ext.Ajax.request( {
		url : "qryNotLookBystudentIdAction.action", //登录处理页面	
		success : function(response, option) {
			var obj = Ext.decode(response.responseText);
			if (obj.success == true) {
				if(obj.size>0){
					document.getElementById("d2").innerHTML = "<span style='color:red'>你有"+obj.size+"条新消息</span>";
				}
			} else {
				
			}
		},
		failure : function(response, option) {
			
		}
		});
}

function isOpenWin(id){
	var tab = center.queryById(id);
	if(tab){
		/*var selectedKeys = Ext.getCmp('messageWest').getSelectionModel().getSelection();
		if(selectedKeys.length>0){
			var studentId=selectedKeys[0].get("studentId");
			return studentId;
		}
		else{
			return -1;
		}*/
		//return TEACHER_ID;
		return true
	}
	else{
		return false;
	}
}

function getWorkTheme(){
	Ext.Ajax.request( {
		url : "getWorkThemeAction.action",	
		success : function(response, option) {
			/*var obj = Ext.decode(response.responseText);
			document.getElementById("Gtheme").innerHTML = obj.themeName;
			//alert(obj.pojo["themeName"]);
*/		},
		failure : function(response, option) {
			
		}
    	});
}
